from flask import Flask,request
from flask import render_template

from reserch import reserch4letters

app = Flask(__name__)

@app.route('/',methods=['GET'])
def hello_world():
    return render_template('hello.html')

@app.route('/index',methods=['GET'])
def index():
    return render_template('index.html')

@app.route('/index_2',methods=['GET'])
def index_2():
    return render_template('index_2.html')
@app.route('/index_3',methods=['GET'])
def index_3():
    return render_template('index_3.html')

@app.route('/Ai软件与应用',methods=['GET'])
def Ai软件与应用():
    return render_template('/课程/Ai软件与应用.html')

@app.route('/Python语言',methods=['GET'])
def Python语言():
    return render_template('/课程/Python语言.html')

@app.route('/乒乓球',methods=['GET'])
def 乒乓球():
    return render_template('/课程/乒乓球.html')

@app.route('/创业实践',methods=['GET'])
def 创业实践():
    return render_template('/课程/创业实践.html')



@app.route('/大学英语',methods=['GET'])
def 大学英语():
    return render_template('/课程/大学英语.html')

@app.route('/毛概实践',methods=['GET'])
def 毛概实践():
    return render_template('/课程/毛概实践.html')

@app.route('/毛概理论',methods=['GET'])
def 毛概理论():
    return render_template('/课程/毛概理论.html')

@app.route('/用户研究',methods=['GET'])
def 中西方哲学社会科学研究():
    return render_template('/课程/中西方哲学社会科学研究.html')

@app.route('/VI设计与品牌策划',methods=['GET'])
def VI设计与品牌策划():
    return render_template('/课程/VI设计与品牌策划.html')

# 【POST】实现用户输入，点击提交，将数据提交到 /result
@app.route('/result',methods=['POST'])
def result():
    py_firstname = request.form['firstname']
    py_lastname = request.form['lastname']
    py_fullname = py_firstname.title() + ' ' + py_lastname.title()

    return render_template('result.html',
                        fullname=py_fullname)


@app.route('/result_2', methods=['POST'])
def result_2():
      py_word = request.form['word']
      py_vowels = request.form['vowels']
      py_found = reserch4letters(py_vowels, py_word)

      return render_template('result_2.html',
                             found=py_found)

if __name__ == '__main__':
    app.run(host='127.0.0.1',port=5000,debug=True)
